/**
 * Created by rockyren on 14/11/29.
 */
describe('Unit: personal ui路由测试',function(){
  beforeEach(module('personalApp'));

  var $state,$rootScope,$httpBackend;

  beforeEach(inject(function(_$state_,_$rootScope_,_$httpBackend_){
    $state = _$state_;
    $rootScope = _$rootScope_;
    $httpBackend = _$httpBackend_;
  }));

  function checkRouteState(routeState,targetUrl) {
    it('加载' + routeState + '状态时,应该加载' + targetUrl + '路由',function(){
      //$state.href会将#前缀也加上去
      expect($state.href(routeState)).toEqual('#' + targetUrl);
      expect($state.href(routeState)).not.toEqual('/not/a/route');

    });
  }

  describe('index route',function(){
    checkRouteState('index','/');
  });

  describe('baseinfo route',function(){
    checkRouteState('index.baseinfo','/baseinfo');
  });

  describe('address route',function(){
    checkRouteState('index.address','/address');
  });

  describe('order route',function(){
    checkRouteState('index.order','/order');
  });

});